package com.jeespring.common.constant;

/**
 * @title:
 * @description:
 * @author: 张朝阳
 * @date: 2019/5/2 14:33
 */
public class SystemConstant {

    public static Long ROOT_NODE = 0L;

    public enum StatusType {
        INVALID(0, "无效"),
        VALID(1, "有效");

        private Integer code;
        private String type;

        StatusType(Integer code, String type) {
            this.code = code;
            this.type = type;
        }

        public Integer getCode() {
            return this.code;
        }

        public String getType() {
            return this.type;
        }

        public static StatusType get(Integer code) {
            if (code == null) return null;
            for (StatusType type : StatusType.values()) {
                if (code.equals(type.getCode())) return type;
            }
            return null;
        }
    }

    public enum NodeType {
        NODE(0, "节点"),
        LEAF(1, "叶子");

        private Integer code;
        private String type;

        NodeType(Integer code, String type) {
            this.code = code;
            this.type = type;
        }

        public Integer getCode() {
            return this.code;
        }

        public String getType() {
            return this.type;
        }

        public static NodeType get(Integer code) {
            if (code == null) return null;
            for (NodeType type : NodeType.values()) {
                if (code.equals(type.getCode())) return type;
            }
            return null;
        }
    }

}
